{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## CAPM模型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## classwork1-书上例题301\n",
    "\n",
    "history(adjust=ADJUST_PREV, df= True,fill_missing=\"Last\")\n",
    "\n",
    "pd.merge\n",
    "\n",
    "dropna\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 获取数据SHSE.000902与SHSE.600596的数据在2014-01-01到2014-12-31之间的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from gm.api import *\n",
    "set_token(\"eea4b28a3ceb7048603d388bb777ebc67de47385\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt \n",
    "import statsmodels.api as sm\n",
    "import numpy as np  \n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Rf\n",
    "Rf=(0.036+1)**(1/360)-1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_902= history(symbol='SHSE.000902', frequency='1d', start_time='2014-01-01',  end_time='2014-12-31', fields='close,eob', fill_missing=\"Last\", adjust=ADJUST_PREV, df= True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_596= history(symbol='SHSE.600596', frequency='1d', start_time='2014-01-01',  end_time='2014-12-31', fields='close,eob', fill_missing=\"Last\", adjust=ADJUST_PREV, df= True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#data_902.close.shift(1)\n",
    "data0=pd.merge(right=data_902,left=data_596,on=\"eob\")\n",
    "Rm=(data0.close_y/data0.close_y.shift(1)-1).dropna()\n",
    "Rq=(data0.close_x/data0.close_x.shift(1)-1).dropna()\n",
    "model = sm.OLS((Rq-Rf), sm.add_constant(Rm-Rf))\n",
    "result = model.fit()\n",
    "result.params"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>close_x</th>\n",
       "      <th>eob</th>\n",
       "      <th>close_y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6.6178</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "      <td>3028.7490</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6.5514</td>\n",
       "      <td>2014-01-03 00:00:00+08:00</td>\n",
       "      <td>3001.4619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6.0986</td>\n",
       "      <td>2014-01-06 00:00:00+08:00</td>\n",
       "      <td>2927.4771</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6.1046</td>\n",
       "      <td>2014-01-07 00:00:00+08:00</td>\n",
       "      <td>2938.6021</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6.0744</td>\n",
       "      <td>2014-01-08 00:00:00+08:00</td>\n",
       "      <td>2950.7329</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>239</th>\n",
       "      <td>6.6437</td>\n",
       "      <td>2014-12-25 00:00:00+08:00</td>\n",
       "      <td>4308.4941</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>240</th>\n",
       "      <td>6.6684</td>\n",
       "      <td>2014-12-26 00:00:00+08:00</td>\n",
       "      <td>4396.2959</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241</th>\n",
       "      <td>6.4829</td>\n",
       "      <td>2014-12-29 00:00:00+08:00</td>\n",
       "      <td>4370.1890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>242</th>\n",
       "      <td>6.3839</td>\n",
       "      <td>2014-12-30 00:00:00+08:00</td>\n",
       "      <td>4334.9771</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>243</th>\n",
       "      <td>6.4210</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "      <td>4403.6182</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>244 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     close_x                       eob    close_y\n",
       "0     6.6178 2014-01-02 00:00:00+08:00  3028.7490\n",
       "1     6.5514 2014-01-03 00:00:00+08:00  3001.4619\n",
       "2     6.0986 2014-01-06 00:00:00+08:00  2927.4771\n",
       "3     6.1046 2014-01-07 00:00:00+08:00  2938.6021\n",
       "4     6.0744 2014-01-08 00:00:00+08:00  2950.7329\n",
       "..       ...                       ...        ...\n",
       "239   6.6437 2014-12-25 00:00:00+08:00  4308.4941\n",
       "240   6.6684 2014-12-26 00:00:00+08:00  4396.2959\n",
       "241   6.4829 2014-12-29 00:00:00+08:00  4370.1890\n",
       "242   6.3839 2014-12-30 00:00:00+08:00  4334.9771\n",
       "243   6.4210 2014-12-31 00:00:00+08:00  4403.6182\n",
       "\n",
       "[244 rows x 3 columns]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data0=pd.merge(right=data_902,left=data_596,on=\"eob\")\n",
    "data0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Rq Rm\n",
    "Rm=(data0.close_y/data0.close_y.shift(1)-1).dropna()\n",
    "Rq=(data0.close_x/data0.close_x.shift(1)-1).dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x16aee737108>]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAD4CAYAAAAZ1BptAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAr8UlEQVR4nO3df5Ac5X3n8fdXq5FZ2Q4rxQKLRbIUlywfHEaCPaBKl9wZ/wDjnCXjYEOchLNdIVSZy+FydF6Cy8Y/7thY8TlxHWdOcaiTy8QIG7yWAzkZIye+4042K6+EkI0OgQFppQPFIJygDVqtvvfH9Cy9s90z3dM9Mz0zn1fV1s50P939zKz0fLufn+buiIiIRJnX7gyIiEhxKUiIiEgsBQkREYmlICEiIrEUJEREJNb8dmcgT6973et8xYoV7c6GiEhH2bVr19+7+5KofV0VJFasWMHY2Fi7syEi0lHM7Om4fapuEhGRWAoSIiISS0FCRERiKUiIiEgsBQkREYmVS5Aws8vNbL+ZHTCz4Yj9bzaz/2NmL5vZHyU51swWm9kDZvZ48HtRHnkVkeYYHZ9g3cgOVg7fx7qRHYyOT7Q7S5KDzEHCzPqA24B3AecA15jZOVXJngf+EPjTFMcOAw+6+yrgweC9iBTQ6PgEN927l4ljkzgwcWySm+7dq0DRBfJ4krgIOODu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acWkWJDi2Hflqtkx5M7MS5QBxp7vfW5R8Vbj7MTP7W+ByoG1Bom2NIZ34A2xidmPnFyLSzAeepBwQKo1W50ake4r8Gq4z5QtYFUr374BvFeU7o/wf5KfAkiL+Lcmv4TrJtd7N7MbOH6f5N9fqfIX2r6A5DddZvjMDvgb8WcHytQQYCF73A/8T+M2885jq87Tz4p32A/wq8CDwePB7cbD9LOD+ULorKPeWeAK4OeZcT5FfkMiUL8p3U48CjwDfBQaL8p0BByjX3e4OfnLpeZVDvt5L+W7wZeBZYHsOeZpzLeB64PrgtQG3Bfv3EgpOSf7NtSlf3wCOAFPB9/WRIuQN+JeUq3ceCf3buqIA+XoLMB7k61HgU3l+X438aFoOERGJpd5NIiISS0FCRERiKUiIiEgsBQkREYmlICEiIrEUJEREJJaChIiIxPr/DVS2I/srXRgAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(Rm-Rf,Rq-Rf,\"o\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\wp\\anaconda3\\lib\\site-packages\\statsmodels\\tsa\\tsatools.py:142: FutureWarning: In a future version of pandas all arguments of concat except for the argument 'objs' will be keyword-only\n",
      "  x = pd.concat(x[::order], 1)\n"
     ]
    }
   ],
   "source": [
    "model = sm.OLS((Rq-Rf), sm.add_constant(Rm-Rf))\n",
    "result = model.fit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table class=\"simpletable\">\n",
       "<caption>OLS Regression Results</caption>\n",
       "<tr>\n",
       "  <th>Dep. Variable:</th>         <td>close_x</td>     <th>  R-squared:         </th> <td>   0.242</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Model:</th>                   <td>OLS</td>       <th>  Adj. R-squared:    </th> <td>   0.239</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Method:</th>             <td>Least Squares</td>  <th>  F-statistic:       </th> <td>   77.02</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Date:</th>             <td>Thu, 02 Jun 2022</td> <th>  Prob (F-statistic):</th> <td>3.16e-16</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Time:</th>                 <td>11:16:11</td>     <th>  Log-Likelihood:    </th> <td>  580.35</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>No. Observations:</th>      <td>   243</td>      <th>  AIC:               </th> <td>  -1157.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Df Residuals:</th>          <td>   241</td>      <th>  BIC:               </th> <td>  -1150.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Df Model:</th>              <td>     1</td>      <th>                     </th>     <td> </td>   \n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Covariance Type:</th>      <td>nonrobust</td>    <th>                     </th>     <td> </td>   \n",
       "</tr>\n",
       "</table>\n",
       "<table class=\"simpletable\">\n",
       "<tr>\n",
       "     <td></td>        <th>coef</th>     <th>std err</th>      <th>t</th>      <th>P>|t|</th>  <th>[0.025</th>    <th>0.975]</th>  \n",
       "</tr>\n",
       "<tr>\n",
       "  <th>const</th>   <td>   -0.0016</td> <td>    0.001</td> <td>   -1.102</td> <td> 0.272</td> <td>   -0.004</td> <td>    0.001</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>close_y</th> <td>    1.1238</td> <td>    0.128</td> <td>    8.776</td> <td> 0.000</td> <td>    0.872</td> <td>    1.376</td>\n",
       "</tr>\n",
       "</table>\n",
       "<table class=\"simpletable\">\n",
       "<tr>\n",
       "  <th>Omnibus:</th>       <td>49.522</td> <th>  Durbin-Watson:     </th> <td>   1.985</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Prob(Omnibus):</th> <td> 0.000</td> <th>  Jarque-Bera (JB):  </th> <td> 232.212</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Skew:</th>          <td> 0.695</td> <th>  Prob(JB):          </th> <td>3.77e-51</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Kurtosis:</th>      <td> 7.583</td> <th>  Cond. No.          </th> <td>    89.5</td>\n",
       "</tr>\n",
       "</table><br/><br/>Notes:<br/>[1] Standard Errors assume that the covariance matrix of the errors is correctly specified."
      ],
      "text/plain": [
       "<class 'statsmodels.iolib.summary.Summary'>\n",
       "\"\"\"\n",
       "                            OLS Regression Results                            \n",
       "==============================================================================\n",
       "Dep. Variable:                close_x   R-squared:                       0.242\n",
       "Model:                            OLS   Adj. R-squared:                  0.239\n",
       "Method:                 Least Squares   F-statistic:                     77.02\n",
       "Date:                Thu, 02 Jun 2022   Prob (F-statistic):           3.16e-16\n",
       "Time:                        11:16:11   Log-Likelihood:                 580.35\n",
       "No. Observations:                 243   AIC:                            -1157.\n",
       "Df Residuals:                     241   BIC:                            -1150.\n",
       "Df Model:                           1                                         \n",
       "Covariance Type:            nonrobust                                         \n",
       "==============================================================================\n",
       "                 coef    std err          t      P>|t|      [0.025      0.975]\n",
       "------------------------------------------------------------------------------\n",
       "const         -0.0016      0.001     -1.102      0.272      -0.004       0.001\n",
       "close_y        1.1238      0.128      8.776      0.000       0.872       1.376\n",
       "==============================================================================\n",
       "Omnibus:                       49.522   Durbin-Watson:                   1.985\n",
       "Prob(Omnibus):                  0.000   Jarque-Bera (JB):              232.212\n",
       "Skew:                           0.695   Prob(JB):                     3.77e-51\n",
       "Kurtosis:                       7.583   Cond. No.                         89.5\n",
       "==============================================================================\n",
       "\n",
       "Notes:\n",
       "[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n",
       "\"\"\""
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "const     -0.0016\n",
       "close_y    1.1238\n",
       "dtype: float64"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result.params"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-5.00000000e-02, -4.50000000e-02, -4.00000000e-02, -3.50000000e-02,\n",
       "       -3.00000000e-02, -2.50000000e-02, -2.00000000e-02, -1.50000000e-02,\n",
       "       -1.00000000e-02, -5.00000000e-03, -2.77555756e-17,  5.00000000e-03,\n",
       "        1.00000000e-02,  1.50000000e-02,  2.00000000e-02,  2.50000000e-02,\n",
       "        3.00000000e-02,  3.50000000e-02,  4.00000000e-02,  4.50000000e-02])"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x=np.arange(-0.05,0.05,0.005)\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-0.05779 , -0.052171, -0.046552, -0.040933, -0.035314, -0.029695,\n",
       "       -0.024076, -0.018457, -0.012838, -0.007219, -0.0016  ,  0.004019,\n",
       "        0.009638,  0.015257,  0.020876,  0.026495,  0.032114,  0.037733,\n",
       "        0.043352,  0.048971])"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y=-0.0016+1.1238*x\n",
    "y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x16aee6f6c08>]"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAD4CAYAAAAZ1BptAAAAOXRFWHRTb2Z0d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ryqtrnpNuKsWFjs0v09cd//Sh0bgXJ3pcZMji12nb5+VW1U1VcBVPVDYBc+a90XsVz+/ojISOCzwC+6MtOJLEh0raGq2gjg/r7YI00FcDDh/SF3GyIyB2hQ1W35zmie5HT9Sb6Kc/dV7DK5Hr80mX4XxSyX6z9HRMYAU4FXgs9iXuV6/f+Mc1MYy1P+0kq7xrXJjoi8CAzz2PVgpqfw2KYi0s89x22dzVtXyNf1J33GgzgrFj6ZXe4KIu31pEiTybHFLpfrd3aKXAgsx1mh8kSAeesKnb5+EbkDOKKqW0TkpqAzlikLEgFT1c/47RORd+OP0e7j5BGPZIdw2h3iRgKHgcuAscA2EYlvf1VErlHVdwK7gBzl8frj57gHuAO4Rd0K2yKX8nrSpOmdwbHFLpfrR0QiOAHiSVVdkcd85ksu138nMEdEZgF9gf4i8u+q+t/ymN+OCt2w05N+gMW0b7j9kUeaXsB+nIAQb+ia6JHuAN2v4Tqn6wdmAjuBIYW+liyuOe3fE6fOObHhclM2/xaK+SfH6xfgV8A/F/o6CnH9SWluokAN1wX/EnvSD3AR8BKwx/09yN0+AliTkG4WTk+OfcCDPufqjkEip+sH9uLU3W51f35e6GvK8Lo7XA9wH3Cf+1qAR93924HKbP4tFPtPZ68fuAGnaua1hL/5rEJfT1f+/RPOUbAgYdNyGGOM8WW9m4wxxviyIGGMMcaXBQljjDG+LEgYY4zxZUHCGGOMLwsSxhhjfFmQMMYY4+v/A3vZDNWAwZMIAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(Rm-Rf,Rq-Rf,\"o\")\n",
    "plt.plot(x,y,\"-\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     -0.0091\n",
       "2     -0.0247\n",
       "3      0.0037\n",
       "4      0.0040\n",
       "5     -0.0116\n",
       "        ...  \n",
       "239    0.0242\n",
       "240    0.0203\n",
       "241   -0.0060\n",
       "242   -0.0082\n",
       "243    0.0157\n",
       "Name: close_y, Length: 243, dtype: float64"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Rq-Rf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>close</th>\n",
       "      <th>eob</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>3028.7490</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3001.4619</td>\n",
       "      <td>2014-01-03 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2927.4771</td>\n",
       "      <td>2014-01-06 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2938.6021</td>\n",
       "      <td>2014-01-07 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2950.7329</td>\n",
       "      <td>2014-01-08 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>240</th>\n",
       "      <td>4308.4941</td>\n",
       "      <td>2014-12-25 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241</th>\n",
       "      <td>4396.2959</td>\n",
       "      <td>2014-12-26 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>242</th>\n",
       "      <td>4370.1890</td>\n",
       "      <td>2014-12-29 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>243</th>\n",
       "      <td>4334.9771</td>\n",
       "      <td>2014-12-30 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>244</th>\n",
       "      <td>4403.6182</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>245 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         close                       eob\n",
       "0    3028.7490 2014-01-02 00:00:00+08:00\n",
       "1    3001.4619 2014-01-03 00:00:00+08:00\n",
       "2    2927.4771 2014-01-06 00:00:00+08:00\n",
       "3    2938.6021 2014-01-07 00:00:00+08:00\n",
       "4    2950.7329 2014-01-08 00:00:00+08:00\n",
       "..         ...                       ...\n",
       "240  4308.4941 2014-12-25 00:00:00+08:00\n",
       "241  4396.2959 2014-12-26 00:00:00+08:00\n",
       "242  4370.1890 2014-12-29 00:00:00+08:00\n",
       "243  4334.9771 2014-12-30 00:00:00+08:00\n",
       "244  4403.6182 2014-12-31 00:00:00+08:00\n",
       "\n",
       "[245 rows x 2 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_902"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>close</th>\n",
       "      <th>eob</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>3028.7490</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3001.4619</td>\n",
       "      <td>2014-01-03 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2927.4771</td>\n",
       "      <td>2014-01-06 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2938.6021</td>\n",
       "      <td>2014-01-07 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2950.7329</td>\n",
       "      <td>2014-01-08 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>240</th>\n",
       "      <td>4308.4941</td>\n",
       "      <td>2014-12-25 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241</th>\n",
       "      <td>4396.2959</td>\n",
       "      <td>2014-12-26 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>242</th>\n",
       "      <td>4370.1890</td>\n",
       "      <td>2014-12-29 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>243</th>\n",
       "      <td>4334.9771</td>\n",
       "      <td>2014-12-30 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>244</th>\n",
       "      <td>4403.6182</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>245 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         close                       eob\n",
       "0    3028.7490 2014-01-02 00:00:00+08:00\n",
       "1    3001.4619 2014-01-03 00:00:00+08:00\n",
       "2    2927.4771 2014-01-06 00:00:00+08:00\n",
       "3    2938.6021 2014-01-07 00:00:00+08:00\n",
       "4    2950.7329 2014-01-08 00:00:00+08:00\n",
       "..         ...                       ...\n",
       "240  4308.4941 2014-12-25 00:00:00+08:00\n",
       "241  4396.2959 2014-12-26 00:00:00+08:00\n",
       "242  4370.1890 2014-12-29 00:00:00+08:00\n",
       "243  4334.9771 2014-12-30 00:00:00+08:00\n",
       "244  4403.6182 2014-12-31 00:00:00+08:00\n",
       "\n",
       "[245 rows x 2 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_902"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>close</th>\n",
       "      <th>eob</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6.6178</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6.5514</td>\n",
       "      <td>2014-01-03 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6.0986</td>\n",
       "      <td>2014-01-06 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6.1046</td>\n",
       "      <td>2014-01-07 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6.0744</td>\n",
       "      <td>2014-01-08 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>239</th>\n",
       "      <td>6.6437</td>\n",
       "      <td>2014-12-25 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>240</th>\n",
       "      <td>6.6684</td>\n",
       "      <td>2014-12-26 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241</th>\n",
       "      <td>6.4829</td>\n",
       "      <td>2014-12-29 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>242</th>\n",
       "      <td>6.3839</td>\n",
       "      <td>2014-12-30 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>243</th>\n",
       "      <td>6.4210</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>244 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      close                       eob\n",
       "0    6.6178 2014-01-02 00:00:00+08:00\n",
       "1    6.5514 2014-01-03 00:00:00+08:00\n",
       "2    6.0986 2014-01-06 00:00:00+08:00\n",
       "3    6.1046 2014-01-07 00:00:00+08:00\n",
       "4    6.0744 2014-01-08 00:00:00+08:00\n",
       "..      ...                       ...\n",
       "239  6.6437 2014-12-25 00:00:00+08:00\n",
       "240  6.6684 2014-12-26 00:00:00+08:00\n",
       "241  6.4829 2014-12-29 00:00:00+08:00\n",
       "242  6.3839 2014-12-30 00:00:00+08:00\n",
       "243  6.4210 2014-12-31 00:00:00+08:00\n",
       "\n",
       "[244 rows x 2 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_596"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 由于数据缺失，通过pd.merge基于eob连接数据，并计算对应的Ri Rm Rf，然后做出Rm-Rf 与Ri-Rf的散点图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>close_x</th>\n",
       "      <th>eob</th>\n",
       "      <th>close_y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6.6178</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "      <td>3028.7490</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6.5514</td>\n",
       "      <td>2014-01-03 00:00:00+08:00</td>\n",
       "      <td>3001.4619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6.0986</td>\n",
       "      <td>2014-01-06 00:00:00+08:00</td>\n",
       "      <td>2927.4771</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6.1046</td>\n",
       "      <td>2014-01-07 00:00:00+08:00</td>\n",
       "      <td>2938.6021</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6.0744</td>\n",
       "      <td>2014-01-08 00:00:00+08:00</td>\n",
       "      <td>2950.7329</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>239</th>\n",
       "      <td>6.6437</td>\n",
       "      <td>2014-12-25 00:00:00+08:00</td>\n",
       "      <td>4308.4941</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>240</th>\n",
       "      <td>6.6684</td>\n",
       "      <td>2014-12-26 00:00:00+08:00</td>\n",
       "      <td>4396.2959</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241</th>\n",
       "      <td>6.4829</td>\n",
       "      <td>2014-12-29 00:00:00+08:00</td>\n",
       "      <td>4370.1890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>242</th>\n",
       "      <td>6.3839</td>\n",
       "      <td>2014-12-30 00:00:00+08:00</td>\n",
       "      <td>4334.9771</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>243</th>\n",
       "      <td>6.4210</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "      <td>4403.6182</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>244 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     close_x                       eob    close_y\n",
       "0     6.6178 2014-01-02 00:00:00+08:00  3028.7490\n",
       "1     6.5514 2014-01-03 00:00:00+08:00  3001.4619\n",
       "2     6.0986 2014-01-06 00:00:00+08:00  2927.4771\n",
       "3     6.1046 2014-01-07 00:00:00+08:00  2938.6021\n",
       "4     6.0744 2014-01-08 00:00:00+08:00  2950.7329\n",
       "..       ...                       ...        ...\n",
       "239   6.6437 2014-12-25 00:00:00+08:00  4308.4941\n",
       "240   6.6684 2014-12-26 00:00:00+08:00  4396.2959\n",
       "241   6.4829 2014-12-29 00:00:00+08:00  4370.1890\n",
       "242   6.3839 2014-12-30 00:00:00+08:00  4334.9771\n",
       "243   6.4210 2014-12-31 00:00:00+08:00  4403.6182\n",
       "\n",
       "[244 rows x 3 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x160ff110848>]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAD4CAYAAAAZ1BptAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAr8UlEQVR4nO3df5Ac5X3n8fdXq5FZ2Q4rxQKLRbIUlywfHEaCPaBKl9wZ/wDjnCXjYEOchLNdIVSZy+FydF6Cy8Y/7thY8TlxHWdOcaiTy8QIG7yWAzkZIye+4042K6+EkI0OgQFppQPFIJygDVqtvvfH9Cy9s90z3dM9Mz0zn1fV1s50P939zKz0fLufn+buiIiIRJnX7gyIiEhxKUiIiEgsBQkREYmlICEiIrEUJEREJNb8dmcgT6973et8xYoV7c6GiEhH2bVr19+7+5KofV0VJFasWMHY2Fi7syEi0lHM7Om4fapuEhGRWAoSIiISS0FCRERiKUiIiEgsBQkREYmVS5Aws8vNbL+ZHTCz4Yj9bzaz/2NmL5vZHyU51swWm9kDZvZ48Ht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I2/J8ufs0sCZof/u2mf1zd29Km04SChJV3P3tcfvM7NnKo2rwOP1cRLJDlNsdKs4GDgNvBFYCe8yssv0nZnaRu/+/Nuar2l8B95EiSDQ7b2Z2LfCbwNs8qKwtQr5yluRacWkWJDi2Hflqtkx5M7MS5QBxp7vfW5R8Vbj7MTP7W+ByoG1Bom2NIZ34A2xidmPnFyLSzAeepBwQKo1W50ake4r8Gq4z5QtYFUr374BvFeU7o/wf5KfAkiL+Lcmv4TrJtd7N7MbOH6f5N9fqfIX2r6A5DddZvjMDvgb8WcHytQQYCF73A/8T+M2885jq87Tz4p32A/wq8CDwePB7cbD9LOD+ULorKPeWeAK4OeZcT5FfkMiUL8p3U48CjwDfBQaL8p0BByjX3e4OfnLpeZVDvt5L+W7wZeBZYHsOeZpzLeB64PrgtQG3Bfv3EgpOSf7NtSlf3wCOAFPB9/WRIuQN+JeUq3ceCf3buqIA+XoLMB7k61HgU3l+X438aFoOERGJpd5NIiISS0FCRERiKUiIiEgsBQkREYmlICEiIrEUJEREJJaChIiIxPr/DVS2I/srXRgAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 通过sm.OLS函数进行线性拟合，并画出拟合结果\n",
    "\n",
    "np.arange"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\wp\\anaconda3\\lib\\site-packages\\statsmodels\\tsa\\tsatools.py:142: FutureWarning: In a future version of pandas all arguments of concat except for the argument 'objs' will be keyword-only\n",
      "  x = pd.concat(x[::order], 1)\n"
     ]
    }
   ],
   "source": [
    "model = sm.OLS((Rq-Rf), sm.add_constant(Rm-Rf))\n",
    "result = model.fit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table class=\"simpletable\">\n",
       "<caption>OLS Regression Results</caption>\n",
       "<tr>\n",
       "  <th>Dep. Variable:</th>         <td>close_x</td>     <th>  R-squared:         </th> <td>   0.242</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Model:</th>                   <td>OLS</td>       <th>  Adj. R-squared:    </th> <td>   0.239</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Method:</th>             <td>Least Squares</td>  <th>  F-statistic:       </th> <td>   77.02</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Date:</th>             <td>Wed, 01 Jun 2022</td> <th>  Prob (F-statistic):</th> <td>3.16e-16</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Time:</th>                 <td>21:21:30</td>     <th>  Log-Likelihood:    </th> <td>  580.35</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>No. Observations:</th>      <td>   243</td>      <th>  AIC:               </th> <td>  -1157.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Df Residuals:</th>          <td>   241</td>      <th>  BIC:               </th> <td>  -1150.</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Df Model:</th>              <td>     1</td>      <th>                     </th>     <td> </td>   \n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Covariance Type:</th>      <td>nonrobust</td>    <th>                     </th>     <td> </td>   \n",
       "</tr>\n",
       "</table>\n",
       "<table class=\"simpletable\">\n",
       "<tr>\n",
       "     <td></td>        <th>coef</th>     <th>std err</th>      <th>t</th>      <th>P>|t|</th>  <th>[0.025</th>    <th>0.975]</th>  \n",
       "</tr>\n",
       "<tr>\n",
       "  <th>const</th>   <td>   -0.0016</td> <td>    0.001</td> <td>   -1.102</td> <td> 0.272</td> <td>   -0.004</td> <td>    0.001</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>close_y</th> <td>    1.1238</td> <td>    0.128</td> <td>    8.776</td> <td> 0.000</td> <td>    0.872</td> <td>    1.376</td>\n",
       "</tr>\n",
       "</table>\n",
       "<table class=\"simpletable\">\n",
       "<tr>\n",
       "  <th>Omnibus:</th>       <td>49.522</td> <th>  Durbin-Watson:     </th> <td>   1.985</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Prob(Omnibus):</th> <td> 0.000</td> <th>  Jarque-Bera (JB):  </th> <td> 232.212</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Skew:</th>          <td> 0.695</td> <th>  Prob(JB):          </th> <td>3.77e-51</td>\n",
       "</tr>\n",
       "<tr>\n",
       "  <th>Kurtosis:</th>      <td> 7.583</td> <th>  Cond. No.          </th> <td>    89.5</td>\n",
       "</tr>\n",
       "</table><br/><br/>Notes:<br/>[1] Standard Errors assume that the covariance matrix of the errors is correctly specified."
      ],
      "text/plain": [
       "<class 'statsmodels.iolib.summary.Summary'>\n",
       "\"\"\"\n",
       "                            OLS Regression Results                            \n",
       "==============================================================================\n",
       "Dep. Variable:                close_x   R-squared:                       0.242\n",
       "Model:                            OLS   Adj. R-squared:                  0.239\n",
       "Method:                 Least Squares   F-statistic:                     77.02\n",
       "Date:                Wed, 01 Jun 2022   Prob (F-statistic):           3.16e-16\n",
       "Time:                        21:21:30   Log-Likelihood:                 580.35\n",
       "No. Observations:                 243   AIC:                            -1157.\n",
       "Df Residuals:                     241   BIC:                            -1150.\n",
       "Df Model:                           1                                         \n",
       "Covariance Type:            nonrobust                                         \n",
       "==============================================================================\n",
       "                 coef    std err          t      P>|t|      [0.025      0.975]\n",
       "------------------------------------------------------------------------------\n",
       "const         -0.0016      0.001     -1.102      0.272      -0.004       0.001\n",
       "close_y        1.1238      0.128      8.776      0.000       0.872       1.376\n",
       "==============================================================================\n",
       "Omnibus:                       49.522   Durbin-Watson:                   1.985\n",
       "Prob(Omnibus):                  0.000   Jarque-Bera (JB):              232.212\n",
       "Skew:                           0.695   Prob(JB):                     3.77e-51\n",
       "Kurtosis:                       7.583   Cond. No.                         89.5\n",
       "==============================================================================\n",
       "\n",
       "Notes:\n",
       "[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n",
       "\"\"\""
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "const     -0.0016\n",
       "close_y    1.1238\n",
       "dtype: float64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result.params"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x28a5b833bc8>]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAD4CAYAAAAZ1BptAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAxc0lEQVR4nO3dfXxU9Z3o8c83IYEACgQSjDxjYyh21WoWdW0tLNZV2y7au1J1u6XVLXW3rtu6e6+03mutvbsvbNfauuvqpa13cV9tae6uD+jV6wMLtttWJbSa+kAkoJUIJYEICIQ8fu8f5wyZTM6ZOTPnzMyZ5Pt+vfKamfMw85sQft9zfg/fn6gqxhhjjJeyYhfAGGNMfFmQMMYY48uChDHGGF8WJIwxxviyIGGMMcbXuGIXIEozZszQ+fPnF7sYxhhTUrZt27ZfVWu89o2qIDF//nyam5uLXQxjjCkpIvJbv33W3GSMMcaXBQljjDG+LEgYY4zxZUHCGGOMLwsSxhhjfEUSJETkUhFpFZE2EVnjsX+RiPxSRHpE5G+DnCsi1SLyjIjscB+nRVFWY0yetDTB3R+A26c6jy1NxS6R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V5r7eILkiEKhfO1dQrQAvwGDArLr8zoA2n7fYl9yeSkVcRlOtKnKvBHmAf8FQEZRrxWcANwA3ucwHudff/hqTgFORvrkjl+jGwF+hzf1/Xx6FswIdwmndakv62Lo9Buc4Efu2W6xXgtih/X7n8WFoOY4wxvmx0kzHGGF8WJIwxxviyIGGMMcaXBQljjDG+LEgYY4zxZUHCGGOMLwsSxhhjfP1/c/2eiTHyYUoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## classwork 2\n",
    "\n",
    "书本 306页题目"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "(0.1-0.04)*1=Rq-0.04"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## classwork3\n",
    "\n",
    "计算SHSE.000300中的股票在2014年的alpha与beta值，并选择其中alpha值为前10个股票，看是否接下来一年的平均收益高于SHSE.000300\n",
    "\n",
    "get_history_constituents"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['SZSE.002236', 'SZSE.002241', 'SHSE.601618', 'SHSE.601633', 'SHSE.601628', 'SZSE.002304', 'SZSE.002310', 'SZSE.002269', 'SHSE.601666', 'SHSE.601717', 'SZSE.002344', 'SZSE.002294', 'SHSE.601668', 'SHSE.601669', 'SZSE.002353', 'SZSE.002299', 'SHSE.601688', 'SZSE.002415', 'SHSE.601800', 'SZSE.002422', 'SZSE.002375', 'SHSE.601699', 'SZSE.002431', 'SHSE.601808', 'SZSE.002385', 'SHSE.601766', 'SHSE.601818', 'SZSE.002500', 'SZSE.002450', 'SZSE.002399', 'SZSE.002456', 'SHSE.601901', 'SHSE.601857', 'SHSE.601866', 'SHSE.601918', 'SZSE.002603', 'SHSE.601928', 'SHSE.601933', 'SHSE.601888', 'SZSE.002570', 'SHSE.601939', 'SHSE.603000', 'SHSE.601898', 'SHSE.601899', 'SHSE.601958', 'SZSE.002594', 'SZSE.002653', 'SHSE.601991', 'SHSE.601992', 'SHSE.601988', 'SHSE.601989', 'SZSE.002673', 'SHSE.601998', 'SZSE.000001', 'SZSE.000002', 'SZSE.000012', 'SZSE.000009', 'SZSE.000024', 'SZSE.000039', 'SZSE.000100', 'SZSE.000046', 'SZSE.000060', 'SZSE.000061', 'SZSE.000063', 'SHSE.600000', 'SZSE.000069', 'SHSE.600010', 'SHSE.600011', 'SHSE.600008', 'SHSE.600009', 'SHSE.600015', 'SHSE.600016', 'SHSE.600018', 'SHSE.600019', 'SHSE.600030', 'SHSE.600031', 'SHSE.600027', 'SHSE.600028', 'SHSE.600029', 'SZSE.000156', 'SHSE.600036', 'SZSE.000157', 'SHSE.600100', 'SHSE.600050', 'SHSE.600048', 'SHSE.600104', 'SHSE.600060', 'SHSE.600111', 'SHSE.600062', 'SHSE.600108', 'SHSE.600058', 'SHSE.600109', 'SHSE.600115', 'SHSE.600066', 'SHSE.600068', 'SHSE.600118', 'SHSE.600123', 'SHSE.600079', 'SHSE.600085', 'SHSE.600143', 'SHSE.600089', 'SHSE.600150', 'SHSE.600096', 'SHSE.600153', 'SHSE.600160', 'SZSE.000333', 'SHSE.600157', 'SHSE.600208', 'SHSE.600170', 'SHSE.600216', 'SHSE.600166', 'SHSE.600221', 'SZSE.000338', 'SHSE.600219', 'SZSE.000400', 'SZSE.000401', 'SZSE.000402', 'SHSE.600177', 'SHSE.600188', 'SHSE.600196', 'SZSE.000423', 'SHSE.600252', 'SZSE.000425', 'SHSE.600256', 'SHSE.600309', 'SHSE.600259', 'SHSE.600315', 'SHSE.600316', 'SHSE.600271', 'SHSE.600266', 'SHSE.600267', 'SHSE.600276', 'SHSE.600332', 'SHSE.600340', 'SHSE.600352', 'SHSE.600403', 'SHSE.600348', 'SHSE.600406', 'SZSE.000528', 'SHSE.600362', 'SHSE.600415', 'SZSE.000536', 'SHSE.600372', 'SZSE.000538', 'SHSE.600369', 'SHSE.600376', 'SHSE.600383', 'SZSE.000562', 'SHSE.600436', 'SHSE.600395', 'SHSE.601001', 'SZSE.000623', 'SZSE.000568', 'SZSE.000625', 'SZSE.000630', 'SZSE.000581', 'SHSE.601006', 'SZSE.000629', 'SHSE.601009', 'SHSE.600516', 'SHSE.603993', 'SHSE.601018', 'SHSE.600518', 'SHSE.600519', 'SZSE.000651', 'SZSE.000596', 'SZSE.000598', 'SZSE.000703', 'SHSE.600528', 'SZSE.000656', 'SHSE.600535', 'SZSE.000709', 'SHSE.600489', 'SHSE.600600', 'SHSE.601101', 'SHSE.600546', 'SHSE.600497', 'SZSE.000718', 'SHSE.600547', 'SHSE.600498', 'SHSE.600549', 'SZSE.000725', 'SHSE.601111', 'SHSE.601106', 'SZSE.000728', 'SZSE.000729', 'SZSE.000686', 'SHSE.601117', 'SHSE.601118', 'SZSE.000800', 'SZSE.000750', 'SHSE.600582', 'SHSE.600583', 'SHSE.600585', 'SZSE.000758', 'SHSE.600642', 'SHSE.600637', 'SHSE.600588', 'SHSE.601088', 'SHSE.601139', 'SZSE.000768', 'SHSE.600597', 'SHSE.600648', 'SHSE.600598', 'SHSE.600703', 'SHSE.601098', 'SHSE.600649', 'SHSE.601099', 'SHSE.600660', 'SZSE.000831', 'SZSE.000826', 'SHSE.600655', 'SHSE.600705', 'SZSE.000776', 'SZSE.000783', 'SZSE.000778', 'SHSE.600663', 'SHSE.601158', 'SHSE.600664', 'SHSE.601166', 'SZSE.000792', 'SZSE.000793', 'SHSE.601168', 'SZSE.000839', 'SHSE.600718', 'SHSE.600674', 'SHSE.601169', 'SHSE.601231', 'SHSE.600690', 'SHSE.600741', 'SHSE.601186', 'SZSE.000858', 'SHSE.601238', 'SHSE.600688', 'SHSE.600694', 'SHSE.600739', 'SZSE.000869', 'SHSE.600804', 'SZSE.000876', 'SHSE.600811', 'SZSE.000933', 'SZSE.000878', 'SHSE.601258', 'SHSE.600809', 'SZSE.000937', 'SHSE.601318', 'SZSE.000895', 'SZSE.002001', 'SHSE.600832', 'SHSE.600827', 'SHSE.600783', 'SHSE.601333', 'SHSE.601328', 'SZSE.000960', 'SZSE.000961', 'SHSE.601336', 'SZSE.002007', 'SHSE.600837', 'SZSE.000963', 'SHSE.601288', 'SHSE.600839', 'SZSE.000970', 'SHSE.600900', 'SHSE.600795', 'SZSE.002024', 'SHSE.601299', 'SZSE.000983', 'SHSE.600863', 'SHSE.600859', 'SZSE.002038', 'SHSE.600873', 'SHSE.601369', 'SZSE.002051', 'SHSE.600875', 'SHSE.601377', 'SZSE.000999', 'SHSE.601390', 'SZSE.002106', 'SHSE.600886', 'SHSE.600887', 'SHSE.600893', 'SZSE.002065', 'SHSE.600895', 'SZSE.002069', 'SHSE.601398', 'SZSE.002081', 'SZSE.002129', 'SHSE.600970', 'SHSE.600971', 'SZSE.002142', 'SZSE.002146', 'SZSE.002202', 'SZSE.002155', 'SHSE.601600', 'SHSE.601601', 'SHSE.600997', 'SHSE.600999', 'SZSE.002230', 'SHSE.601555', 'SHSE.601607'])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stock_300=get_history_constituents(index='SHSE.000300', start_date='2014-01-01',end_date=\"2014-12-31\")[0]['constituents'].keys()\n",
    "stock_300"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "stock_s=\",\".join(stock_300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_300= history(symbol=stock_s, frequency='1d', start_time='2014-01-01',  end_time='2014-12-31', fields='close,eob,symbol', fill_missing=\"Last\", adjust=ADJUST_PREV, df= True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "def CAPM_a(x):\n",
    "    data0=pd.merge(right=data_902,left=x,on=\"eob\")\n",
    "    Rm=(data0.close_y/data0.close_y.shift(1)-1).dropna()\n",
    "    Rq=(data0.close_x/data0.close_x.shift(1)-1).dropna()\n",
    "    model = sm.OLS((Rq-Rf), sm.add_constant(Rm-Rf))\n",
    "    result = model.fit()\n",
    "    return result.params[\"const\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\wp\\anaconda3\\lib\\site-packages\\statsmodels\\tsa\\tsatools.py:142: FutureWarning: In a future version of pandas all arguments of concat except for the argument 'objs' will be keyword-only\n",
      "  x = pd.concat(x[::order], 1)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "-0.0013534362396692156"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_300[data_300.symbol=='SHSE.601009']\n",
    "CAPM_a(data_300[data_300.symbol=='SHSE.601009'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [],
   "source": [
    "a1=[]\n",
    "sb=[]\n",
    "for i in stock_300:\n",
    "    a1.append(CAPM_a(data_300[data_300.symbol==i]))\n",
    "    sb.append(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [],
   "source": [
    "a1_sb=pd.DataFrame({\"a1\":a1,\"sb\":sb})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['SHSE.600893', 'SHSE.600519', 'SHSE.601098', 'SHSE.601998',\n",
       "       'SHSE.600582', 'SHSE.601099', 'SHSE.600688', 'SHSE.600109',\n",
       "       'SHSE.600588', 'SZSE.000562'], dtype=object)"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a1_sb.sort_values(by=\"a1\").tail(10).sb.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "33000"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(data_300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "#list(stock_300).join"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "#stock_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'SZSE.000063,SHSE.600000,SZSE.000069,SHSE.600010,'"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stock_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>close</th>\n",
       "      <th>eob</th>\n",
       "      <th>symbol</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>12.9425</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "      <td>SHSE.601607</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6.8117</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "      <td>SHSE.600583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2.6563</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "      <td>SHSE.600115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7.3521</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "      <td>SHSE.600649</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.3493</td>\n",
       "      <td>2014-01-02 00:00:00+08:00</td>\n",
       "      <td>SHSE.601369</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32995</th>\n",
       "      <td>14.9777</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "      <td>SZSE.000783</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32996</th>\n",
       "      <td>13.4837</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "      <td>SZSE.000963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32997</th>\n",
       "      <td>5.6924</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "      <td>SZSE.000338</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32998</th>\n",
       "      <td>8.8080</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "      <td>SZSE.000046</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32999</th>\n",
       "      <td>15.2070</td>\n",
       "      <td>2014-12-31 00:00:00+08:00</td>\n",
       "      <td>SZSE.002344</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>33000 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         close                       eob       symbol\n",
       "0      12.9425 2014-01-02 00:00:00+08:00  SHSE.601607\n",
       "1       6.8117 2014-01-02 00:00:00+08:00  SHSE.600583\n",
       "2       2.6563 2014-01-02 00:00:00+08:00  SHSE.600115\n",
       "3       7.3521 2014-01-02 00:00:00+08:00  SHSE.600649\n",
       "4       5.3493 2014-01-02 00:00:00+08:00  SHSE.601369\n",
       "...        ...                       ...          ...\n",
       "32995  14.9777 2014-12-31 00:00:00+08:00  SZSE.000783\n",
       "32996  13.4837 2014-12-31 00:00:00+08:00  SZSE.000963\n",
       "32997   5.6924 2014-12-31 00:00:00+08:00  SZSE.000338\n",
       "32998   8.8080 2014-12-31 00:00:00+08:00  SZSE.000046\n",
       "32999  15.2070 2014-12-31 00:00:00+08:00  SZSE.002344\n",
       "\n",
       "[33000 rows x 3 columns]"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_300"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     -0.0090\n",
       "2     -0.0246\n",
       "3      0.0038\n",
       "4      0.0041\n",
       "5     -0.0115\n",
       "        ...  \n",
       "239    0.0243\n",
       "240    0.0204\n",
       "241   -0.0059\n",
       "242   -0.0081\n",
       "243    0.0158\n",
       "Name: close_y, Length: 243, dtype: float64"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Rm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\wp\\anaconda3\\lib\\site-packages\\statsmodels\\tsa\\tsatools.py:142: FutureWarning: In a future version of pandas all arguments of concat except for the argument 'objs' will be keyword-only\n",
      "  x = pd.concat(x[::order], 1)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array(['SHSE.600893', 'SHSE.600519', 'SHSE.601098', 'SHSE.601998',\n",
       "       'SHSE.600582', 'SHSE.601099', 'SHSE.600688', 'SHSE.600109',\n",
       "       'SHSE.600588', 'SZSE.000562'], dtype=object)"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stock_300=get_history_constituents(index='SHSE.000300', start_date='2014-01-01',end_date=\"2014-12-31\")[0]['constituents'].keys()\n",
    "data_902= history(symbol='SHSE.000902', frequency='1d', start_time='2014-01-01',  end_time='2014-12-31', \n",
    "                  fields='close,eob', fill_missing=\"Last\", adjust=ADJUST_PREV, df= True)\n",
    "stock_s=\",\".join(stock_300)\n",
    "data_300= history(symbol=stock_s, frequency='1d', start_time='2014-01-01',  end_time='2014-12-31', \n",
    "                  fields='close,eob,symbol', fill_missing=\"Last\", adjust=ADJUST_PREV, df= True)\n",
    "\n",
    "\n",
    "def CAPM_a(x):\n",
    "    data0=pd.merge(right=data_902,left=x,on=\"eob\")\n",
    "    Rm=(data0.close_y/data0.close_y.shift(1)-1).dropna()\n",
    "    Rq=(data0.close_x/data0.close_x.shift(1)-1).dropna()\n",
    "    model = sm.OLS((Rq-Rf), sm.add_constant(Rm-Rf))\n",
    "    result = model.fit()\n",
    "    return result.params[\"const\"]\n",
    "\n",
    "a1=[]\n",
    "sb=[]\n",
    "for i in stock_300:\n",
    "    a1.append(CAPM_a(data_300[data_300.symbol==i]))\n",
    "    sb.append(i)\n",
    "    \n",
    "a1_sb=pd.DataFrame({\"a1\":a1,\"sb\":sb})\n",
    "a1_sb.sort_values(by=\"a1\").tail(10).sb.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
